﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 引用类型参数02
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] aa = new int[3] { 1, 2, 3 };
            MyMath mm = new MyMath();
            mm.Swap(aa);
            Console.WriteLine(aa[0]);
            Console.WriteLine(aa[1]);
        }
    }

    class MyMath
    {
        public void Swap(int[] a)
        {
            if (a.Length > 1)
            {
                int temp = a[0];
                a[0] = a[1];
                a[1] = temp;
            }
            else
            {
                Console.WriteLine("输入的数组不符合规范");
            }
        }
    }
}
